Skip to main content

Full text of "Arduino"

See other formats



build, hack, tweak, share, discover. 


Written By: DaveGun 


Electric or Hand Saw (1) 

Hack saw (1) 

Modeling knife (1) 

Pencil or pen (1) 

Punch (1) 

Scissors (1) 

Screwdriver, Phillips head (1) 

Side cutters (1) 

Soldering/desoldering tools (1) 

Square, adjustable (1) 

Standard drill bits (1) 

Tin snips (1) 

hand electric drill (1) 

mill bastard file (1) 

small pipe cutter (1) 


Motor (2) 

Salvaged from printer 

LED/Photo Sensor (1) 
Salvaged from printer 

Switch, momentary (1) 
Salvaged from printer 

Plastic CardH) 

Salvaged from printer paper holder 

Parallax PIR sensor (3) 

1/4" plywood (1) 

Aluminum Round Tube (1) 

Aluminum square tube (1) 

A 3 foot length will be sufficient 

Angle brackets (9) 

Straight Brackets (2) 

wheels (4) 

Carriage bolt (2) 

Must have long threaded shaft 

3/8" bolt / nuts (8) 
Nuts for Carriage Bolts 

Washers (2) 

To fit on Carriage Bolt 

Swivel Caster Wheel (1) 

Foam Core Board (1) 

Misc. small nuts, bolts, and washers (1) 

For mounting PIRs and Arduino 
Shftprf metal snrews self-tanninn ("h 

© Make Projects 

Pagel of 23 


"i~ i — m ^ f \ - 1 

For mounting motor mounts to rail, etc. 

Wood screws, small (1) 

For mounting caster wheel and sensor to 


Tape, masking (1) 

Adhesive tape, double-sided (1) 

Rubber bands (1) 

Small for drive belts, wide for pulleys 

Zip ties (4) 

Velcro tape (1) 

For mounting batteries 

Arduino Uno (1) 
Arduino Motor Shield (1) 
MakerShield (1) 
8 "AA" Battery holder (1) 
Battery clip 9V(1) 
Jumper Wire (1) 


This project will show you how to build this bot from scratch. The motors, LED/photo sensor 
and bumper switch were salvaged from unused printers. The brains are the Arduino, 
attached to a Motor Shield and MakerShield. The other parts are readily available at most 
hardware stores. 

© Make Projects 

Page 2 of 23 


Step 1 — Salvage Printer Parts 

• A lot of good parts can be salvaged from old printers. For this project, the DC Motor, 
LED/Photo Detector Sensor and the switch with a lever will be used. The location of these 
parts are indicated in the picture. This project will require two DC motors, so two salvaged 
printers will be needed. 

• Remove the two screws securing the motor, and unplug the power wire. Put the motors 
aside so they can be used later. 

• Remove the circuit board. The switch and sensor will need to be de-soldered and removed 
from the board. Note the markings on the circuit board that that indicate what the pins are 
on the sensor. Mark the pins for future reference. 

• Note the nice stepper motor also in the printer. It's not used in this project, but it's 
prime picking for other projects. 


© Make Projects 

Page 3 of 23 


Step 2 — Make the Frame 

• The frame will be made of a 6V2 inch wide by 8 inch long piece of plywood. Two aluminum 
rails will be fastened to the long edge of the plywood. This will form the deck and side rails 
of the frame. 

• Mark the 6V2" wide by 8" long rectangle on the W plywood sheet. Mark 2 inches and 3 
inches from one end to identify location of both axles. 

• Cut two 8 inch sections of 3 A" square tube for the side rails. Mark one with R and the other 
with L on the front top edge so you don't mix these up when working on them. 

• Turn the rail so the inside edge is up. Mark two inches and three inches from the rear edge 
of the square tube. These will be the center line of the two axles. 

• The holes in the side rails will be drilled slightly above the center of the rail. Measure down 
from the top side of both square tubes 5/16" and mark this with a center punch. 

• Drill the forward hole on the right tube to V2", and drill the rearward hole of the left tube to 
V2". Both these holes will go through both sides of the rail. 

• The remaining two holes will be 3/8" holes and these only go through the inside of the rail. 

© Make Projects 

Page 4 of 23 


Step 3 — Make Axles and Sleeves 

• Each axle will run through a sleeve inside the side rails. To make this sleeve, use a pipe 
cutter to cut two %" sections of aluminum round tube. Insert this axle sleeve in the 1/2" 
hole on each rail. 

• Make the axles from two 3/8" x 8" carriage bolts. Using a hack saw, cut the heads from 
two 3/8" x 8" carriage bolts leaving as much shaft length as possible. 

© Make Projects 

Page 5 of 23 


Step 4 — Ready the Deck 

• Test fit the assembly by placing the square tube on the edges of the marked plywood 
rectangle and insert the axles. The axle's threaded end should go through the sleeve, and 
the un-threaded end into the small hole. Make sure the axles turn freely without binding. 

• Cut the plywood on the marks. 

• Tip: Score the marks with a knife and put tape along the edge before sawing to 
prevent the edges from fraying. 

• Place the square tubes on the edges of the board, clamp them in place and drill two pilot 
holes just slightly smaller then the attachment screws. Using 4 sheet metal screws, attach 
the square pipe to the board near the edges of the board making sure these screws do not 
interfere with the axles. 

© Make Projects 

Page 6 of 23 


Step 5 — Make the Axle Location Ring 

• The wheel location sensor uses a stationary photo eye and a slotted washer fixed to the 
axle. The photo eye will count the number of slots that pass the sensor. We will call this 
slotted washer the "axle location ring." 

• The axle location ring is made by using a flat piece of plastic, such as the one from the 
paper tray of the salvaged printer. Drill a 3/8" hole in the plastic. Using a 7/8" washer as a 
template, center the washer on the hole and mark the outside edge of the washer. Use tin 
snips to cut out the plastic washer. 

• Six evenly spaced 1/8" slots need to be cut in the outside edge. To space these equally, 
use a large hex nut as a guide. Center the nut on the plastic washer and mark the points of 
the nut onto the washer. 

• Using a hacksaw, cut six slots in the edge of the plastic washer. 

• Hint: Clamp a straight-edged piece of metal through the center point of the washer 
and use this straight edge as a guide for cutting the slots. Put a mark 1/8 of an inch 
up from the cutting edge of the hacksaw blade as a depth guide to make all cuts to the 
same depth. 

© Make Projects 

Page 7 of 23 


Step 6 — Prepare the Wheels and Pulleys 

• Remove the rubber from two of the 4.5" wheels. These two rims will be used for drive 

• Use a fat rubber band and stretch it over the rim to provide a surface for the belt to ride 
inside the pulley. I also used a section of bicycle inner tube, but it is much harder to 
stretch over the rim. 

© Make Projects 

Page 8 of 23 


Step 7 — Assemble the Wheels and Axle 

• Now it's time to assemble the wheels and axle. Start with the left wheel in the rear hole on 
the left rail. Thread two nuts onto the axle then a metal washer. Run the threaded end of 
the axle from the inside through the sleeve. 

• Thread another nut on the axle, then put on one drive pulley, one wheel, then finally a nut. 
Tighten the wheel and pulley between the two outside nuts just snug enough so the wheel 
and pulley are fixed together. 

• Place the end of the axle into the smaller rear hole in the right rail. Thread the inside two 
nuts up against the sleeve then back them off to allow a little play so the axle and wheel 
spins freely. Tighten the inside two nuts together to form a lock nut. Re-adjust the play if 

• Hint: you can use plumber's Teflon tape and or Teflon lubricant on the axle in the 

sleeve to proved a little dry lubrication. You will need to test fit the wheels and axle 

first. Mark the part of the axle that rides inside the sleeve, then disassemble the assembly 

to expose the part of the axle that receives the lubricant. 

• Do the same procedure for the right wheel in the forward sleeve on the right rail with one 
additional step. The axle location ring (plastic washer with slots) needs to be placed 
between the two nuts on the inside of the axle. 

• The plywood below the axle location ring may need to be ground down a little to allow the 
axle location ring to spin freely. This can be done with a small file, or small wood chisel. 

• The last thing is to attach the caster wheel on the front underside of the plywood with short 
wood screws. Center the wheel and mark the holes. Drill a pilot hole that is slightly smaller 
than the wood screw threads. Secure the caster wheel with the screws. 

© Make Projects 

Page 9 of 23 


Step 8 — Make the Axle Position Sensor 

• It is important for the distance from center to center of the wheels to be 
approximately 9 inches, and twice the diameter of the wheels. One rotation of 
counter-rotating wheels will then turn the bot 180 degrees. The axle location sensor will be 
used to spin the bot to the desired direction. 

• The LED/ Photo Sensor salvaged from the printer needs to be mounted on a small board. 
Cut a small piece of circuit board. Solder wire leads on the four terminals and extend the 
four leads out of the holes in the circuit board. 

• Tape the sensor to a small piece of foam board, then tape a small angle bracket on the 
back of the foam board. Mark the four leads for connection later in the project. 

• The axle location ring will spin inside the slot in the sensor. Test fit the sensor in front of 
the forward axle. The axle location ring must be in the slot as far as possible without 
rubbing on the sides or back of the sensor slot when the wheel spins. 

• The play in the axle may need to be reduced by readjusting the inside nuts on the axle. 
When the sensor is located correctly, mark the hole in the mounting angle bracket. Drill a 
small pilot hole in the deck and attach the sensor with a wood screw. 

© Make Projects 

Page 10 of 23 


Step 9 — Assemble the Motor Mounts 

• Now the right motor mount can be assembled. Attach a motor to a small angle bracket with 
two zip ties. Attach the angle bracket to a second angle bracket and a 3" metal straight 
bracket as shown in the picture. This straight bracket will be used to adjust the motor so 
the belt stays aligned. 

• Place the motor assembly on the right rail in front of the wheel as shown in the picture. 
Place a third angle at the open end of the metal strap in line with the last hole. Align the 
hole of the angle between both axles so the attachment screw will not interfere with the 

• Mark the holes of the two angles and center-punch the mark. Drill pilot holes and attach 
the motor mount with sheet metal screws. 

• Do the same for the left wheel motor. The rear angle bracket will be behind the rear axle so 
the distance from the pulley to the motor will be the same for both motors. Insert a bolt 
with three nuts in the rear angle bracket to the straight bracket as shown in the picture. 
This bolt will be used to align the motors. 

• The drive belts are rubber bands. Stretch the rubber bands over the pulley and motor 
shaft. Move the wheel by hand forward and backwards to check the alignment of the belt. 
Line up the motor shaft as close as possible by eye. 

• The motor can be slid in and out so that the shaft is in line with the pulley. Small 
adjustments can be made by moving the nuts on the adjustment arm. Once the belt stays 
on the motor when the wheel is moved in both directions, the mounts and adjusters can be 

• Hint: if you're having problems aligning the belt you can try pushing up and down on 
the motor shaft to help align the motor. 

© Make Projects 

Page 11 of 23 


Step 10 — Install Arduino and Batteries. 

• A 12V battery pack is being used to 
power the motors, and a 9V is used 
to power the Arduino. Test fit the 
components on the deck. 

• Mark the mounting holes of the 
Arduino to the plywood deck. Drill 
holes and, using small screws, 
attach the board. 

• I use rubber feet stuck on 
the bottom of the board. If 
you don't have these, standoffs 
should be used to mount the 
Arduino board so that the bottom of 
the board is not in contact with the 
wood deck. 

• Adhesive-backed Velcro can be 
used to secure the battery boxes in 
place so they can be removed to 
change the batteries. 


© Make Projects 

Page 12 of 23 


Step 11 — Build the Body 

• Make a right side panel by first using a paper template. Test fit the template to assure that 
it fits properly. The picture shows my template and the dimensions I used. It is 2%" tall 
overall. There is a cutout for the wheel and motor. 

• Once this fits correctly, transfer the template to a piece of foam board. The bottom of the 
foam board can be attached to the square tube with sheet metal screws. 

• The left side panel should have the same cutout, except it will be shifted one inch back. 
You can use the same template modified for the one-inch shift. 

• You may not have room to use a screw on the rear of the foam board side. An alternate 
means of attachment can be used, like masking tape. 

• The rear panel is straightforward. Attach it at the sides and bottom edge with masking 

• The front panel will be the attachment for the bumper and bumper switch. First you will 
need to prepare the switch. 

© Make Projects 

Page 13 of 23 


Step 12 — More Body Parts 

• The switch has a long paddle and works well for a bumper switch. It was salvaged from 
the circuit board of the printer. Mount the switch to a small piece of circuit board. Solder 
some lead wires and route these so they exit the rear of the switch as shown in the 
picture. The wire leads will need to be accessible from inside the body. 

• Test fit the front panel and mark the top edge of the plywood floor on the panel. One 
important step not shown in this picture: locate the spot in this front panel that is in line 
with the USB port on the Arduino board. Cut a small hole to allow connection of the USB 

• Next, cut another notch in the bottom of the front panel so the switch lever can come 
through the front panel. Tape the switch in place from the inside of the panel. 

• Measure and cut the top out of the foam board. Cut four small squares that will keep the 
top in place. Attach the squares with double-sided sticky tape. Do not fasten the top on the 
body; this will need to be removed for access. 

© Make Projects 

Page 14 of 23 


Step 13 — Make the Bumper 

• Attach two small angle brackets to the front panel as shown in the picture. The brackets 
are attached with small screws, nuts and washers. 

• Cut a piece of foam board that will fit inside the angles and hang about an inch below the 
plywood deck. Hinge the bumper on the angles with two pins (small nails) in the sides of 
the foam board so the bumper moves forward and back freely. 

• The bumper can be lifted and tipped back against the body to gain access to the USB hole 
(not shown in this picture). When the bumper is pushed in, it should depress the switch. 
Tape a small square of foam board on the back of the bumper that aligns with the switch 
lever to assure the switch will be fully depressed when the bumper is pushed in. 

© Make Projects 

Page 15 of 23 


Step 14 — Make PIR Sensor Array 

• Cut three strips of foam board 5 inches long and VA inch high. Tape these together to form 
a triangle with corners of approximately 60 degrees. 

• Mount three PIRs with the pins down, one in the center of each side of the triangle. PIRs 
can be mounted with small screws and nuts. Two nuts between the PIR and foam board 
make a good standoff for the PIR circuit board. 

• Mount the triangle to a larger foam board base. Cut out access holes in the foam base to 
the connection pins of the PIRs so they can be wired from inside the body of the bot. 

• Hint: With a marker, write the pin function (GND, 5V, Output) on the bottom of the 
foam base for connection of wiring at a later time. 


© Make Projects 

Page 16 of 23 


Step 15 — Mount PIR Array to Body 

• Position the PIR sensor array on the top body panel with the center of the array 
approximately centered between the wheels. Make cut outs in the top panel for access to 
the PIR pins. 

• Fasten the array with two small bolts, washers and nuts. 

• Finish off the array by cutting and fastening a foam board triangular top. 

© Make Projects 

Page 17 of 23 


Step 16 — Wire the Motor Shield 


• Note: The Arduino Web Page suggests cutting the "Vj n Connect" jumper on the 

back of the motor shield board when using more than 9 volts. Refer to the Arduino 
web site for more information. 

• Attach the 12V positive lead (red) to the V in screw terminal of the motor shield. Attach the 
12V negative lead (black) to the GND screw terminal. 

• The right side motor is attached to the Channel A screw terminals, red to "+" and black to 
"-". The left side motor runs reversed, so connect this to the Channel B screw terminals 
also reversed with the black wire to the "+" and the red wire to the "-". 

• Insert the motor shield on top of the Arduino board. 

© Make Projects 

Page 18 of 23 


Step 17 — Wire the MakerShield: Sensor Array 

M\ — ^y _ 

i! * s= -~~jH 

■ ^-4J ::7;;;;l--::. : ii^M ■ 



^t^Jt^pi^i^i^^i^-^ °^"" 

" —-Ami ■ .^— ^^^"""*!^ 

■ — 

^^.^^^ — ■ 

• Using male/male and female/female leads, make up three sets of power, ground, and 
sensor output wires. Attach the leads to the sensors. 

• In the photos, the red leads are power, the blue are ground, and the other colors are 
sensor leads. The female/female leads are yellow or blue, so the color of the 
male/male lead attached to one end indicates the wire's function. This is typical throughout 
the photos. 

• Connect a row on the breadboard to ground and another row to 5V. Connect all the PIR 
power leads to the 5V row, and all the grounds to the ground row. 

• The PIR input pins are 4, 5, and 6. Pin 4 goes to the left PIR sensor, pin 5 to the right 
sensor, and pin 6 to the rear sensor. 

• The two LEDs built into the board can be connected by running a jumper from LED1 to Pin 
10, and LED to Pin 3. 

• Tip: These LEDs can be used in testing. Place TagBot on a small box so the wheels 
are off the ground so it can be tested on a table. This will be useful when the USB 
cable is connected. 

© Make Projects 

Page 19 of 23 


Step 18 — Wire the MakerShield: Axle Position Sensor: 

• On the 5V row on the breadboard, put a 330 ohm resistor and extend it to another open 

• Connect a lead from this to the LED of the sensor. 

• Put a jumper from the ground row to another open row, connect two ground leads to the 
sensor LED and photo sensor. 

• Connect the output of the photo sensor to Pin 2. 

Step 19 — Wire the Bumper Switch 

• Connect one lead from the bumper 
switch to pin 7 and the other lead 
from the switch to the ground row 
on the breadboard. 

• Plug the MakerShield into the top of 
the Motor Shield. 

© Make Projects 

Page 20 of 23 


Step 20 — Testing and Adjustment. 

© Make Projects Page 21 of 23 


^Bi.^ ^>* ^^ -^ 

• Lift the bumper to gain access to 

the USB hole. Insert the USB plug 

f*vl mj^ 4' $ 7 J 

into the Arduino board and load the 

^HMi w^fa^^ .^^1 


P^^^s^Ssfi^^^ /^^M 

• The sketch can be downloaded 



^ ^^ Jl^r^^ 

• Start Delay: If you want TagBot to 

k^^w "!#</ J 

wait longer than 10 seconds after 

yy ^ ^M*A 

starting, the variable startDelay 


can be increased from 10000 

^E^^ ^j^^Hr - 

milliseconds to a higher value. 

© Make Projects 

• Stable Delay: If TagBot moves 
randomly after each move, you can 
increase the variable 

stableDelay from 500 
milliseconds to a higher value. If 
you do this, TagBot will take longer 
between movements so try to keep 
this value as low as possible. 

• Detect Delay: This allows time for 
a second PIR detection. The PIR 
array needs time to detect motion 
from multiple sensors for the zones 
between the PIRs. If you change 
this delay, make only small 

• Stuck Wheel: If the right wheel 
becomes stuck or the drive belt 
breaks, the movement will stop 
after 5 seconds. The value 
stuckwheel shouldn't need 

• PIR Long Light: If the PIR takes 
longer than about 3 seconds to turn 
off, it may just need more time to 

Page 22 of 23 


stabilize, or it's detecting 
movement. To decrease time 
between movements, decrease the 
value of longiight. To decrease 
false detections, increase this 
timer value. 

Now it's time to turn TagBot loose in the house. Have fun! 


This document was last generated on 2013-02-18 08:11:17 AM. 

© Make Projects 

Page 23 of 23